div{
    width:100px;
    height:100px;
    background-color: red;
    position:relative;
    animation: anim 5s infinite alternate ;//连续执行
}
@keyframes  anim {
    0% {
        background: red;
        left: 0;
        top: 0px
    }
    25% {
        background: blue;
        left: 200px;
        top: 0px
    }
    50% {
        background: greenyellow;
        left: 200px;
        top: 200px;
    }
    75% {
        background: green;
        left: 0px;
        top: 200px;
    }
    100% {
        background: red;
        left: 0px;;
        top: 0px
    }
}